﻿ /******************************************************************************
  * Copyright  2023 - LiuKuan
  * All right reserved. See COPYRIGHT for detailed Information.
  *
  * @file       Application.h
  * @brief
  * @author     <807874484@qq.com>
  * @date       2024/07/29
  * @history
  *****************************************************************************/

#ifndef APPLICATION_H
#define APPLICATION_H


#include <QObject>
#include <QApplication>
#include <QTimer>
#include <QElapsedTimer>
#include <QMap>
#include <QSet>
#include <QMetaMethod>
#include <QMetaObject>
#include <QObject>
#include <QtQml/qqml.h>
#include <QTranslator>
#include <QQmlApplicationEngine>

class Application : public QApplication
{
    Q_OBJECT
    enum LanguageType{
        ZH_CN = 0,
        EN_US = 1
    };
public:
    explicit Application(int &argc, char* argv[]);

    void init(QQmlApplicationEngine *engine);

    QQmlApplicationEngine * engine();

    void setLanguage(int language);

    static Application *app_;
private:
    void initCommon_();
    void registerType_();
private:
    QQmlApplicationEngine * engine_ {nullptr};
    QTranslator translator_ {nullptr};
};

Application* app(void);

#endif // APPLICATION_H
